import { listCompanyDict } from '@/apis'
import type { LabelValueState } from '@/types/global'
import { ref } from 'vue'

/** 公司模块字典 */
export function useCompanyDict(options?: { onSuccess?: () => void }) {
    const loading = ref(false)
    const companyDicList = ref<LabelValueState[]>([])
  
    const getCompanyDicList = async () => {
      try {
        loading.value = true
        const res = await listCompanyDict()
        companyDicList.value = res.data
        options?.onSuccess && options.onSuccess()
      } finally {
        loading.value = false
      }
    }
    return { companyDicList, getCompanyDicList, loading }
  }
  